const express = require('express')
const app = express()
const port = 3333
const Sign = require('./sign')
const Home = require('./home')
const Info = require('./info')

const TimeoutSend = (res, data) => {
  setTimeout(() => {
    res.send(data)
  }, Math.random() * 2000)
}

app.post('/signin', (_, res) => {
  TimeoutSend(res, Sign.In)
})
app.post('/signout', (_, res) => {
  TimeoutSend(res, Sign.Out)
})
app.get('/menu/list', (_, res) => {
  TimeoutSend(res, Sign.MenuList)
})
app.get('/home/userinfo', (_, res) => {
  TimeoutSend(res, Home.UserInfo)
})
app.get('/home/schedule', (_, res) => {
  TimeoutSend(res, Home.Schedule)
})
app.get('/info/base', (_, res) => {
  TimeoutSend(res, Info.Base)
})
app.get('/info/me', (_, res) => {
  TimeoutSend(res, Info.Me)
})

app.listen(port, () => {
  console.log('app listening on port' + port)
})